import {SAVE_ALLELIC_BOUNDARY, SAVE_ALLELIC_OPTION, SAVE_ALLELIC_OPTION2, SAVE_DEGREE,SAVE_ALLELIC_SETTING, SAVE_ALLELIC_TABLE_DATA, SAVE_ALLELIC_TABLE_WELL, SAVE_ANGLE_ARR} from "./constants";

const defaultState = {
  allelicTableWell: new Array(96).fill(""),
  allelicSetting: {
    xAxis: "FAM",
    yAxis: "VIC",
    cycle:40,
    assignCallAuto: false,
    vertical: 37,  //垂直
    horizontal: 37 //水平
  },
  allelicBoundary: {
    x: 37,
    y: 37
  },
  angleArr: [],
  allelicOption: {},
  allelicOption2: {},
  allelicTableData: [],
  degree:[]
};

function reducer(state = defaultState, action) {
  switch (action.type) {
    case SAVE_ALLELIC_TABLE_WELL :
      return {...state, allelicTableWell: action.allelicTableWell};
    case SAVE_ALLELIC_SETTING :
      return {...state, allelicSetting: action.allelicSetting};
    case SAVE_ALLELIC_OPTION :
      return {...state, allelicOption: action.allelicOption};
    case SAVE_ALLELIC_OPTION2 :
      return {...state, allelicOption2: action.allelicOption2};
    case SAVE_ANGLE_ARR:
      return {...state, angleArr: action.angleArr};
    case SAVE_ALLELIC_BOUNDARY :
      return {...state, allelicBoundary: action.allelicBoundary};
    case SAVE_ALLELIC_TABLE_DATA :
      return {...state, allelicTableData: action.allelicTableData};
      case SAVE_DEGREE :
      return {...state, degree: action.degree};
    default:
      return state;
  }
}

export default reducer;
